﻿#ifndef __SS_ACTOR_THREAD_POOL_H__
#define __SS_ACTOR_THREAD_POOL_H__
#include "container/ssArray.h"
#include "thread/threadLock/ssThreadCondition.h"
#include "ssActorThread.h"


namespace StarSeeker
{

class ssActorThreadPool
{
	friend class ssActorThread;
public:
	ssActorThreadPool();
	~ssActorThreadPool();

	//启动线程组
	void Start();
	//退出线程组
	void Exit();

	//增加工作线程，必须在线程未启动状态
	void AddThread(ssActorThread* pThread);
	void AddThreads(ssActorThread* pThreadArr[], u32 count);

	//唤醒工作线程
	void NotifyOneWorker();
	void NotifyAllWorker();

protected:
	ssArray<ssActorThread*>		m_threads;
	ssThreadLock				m_mutex;		//互斥量，配合条件变量使用
	ssThreadCondition			m_condGet;		//读取条件变量

	static int					s_weight[32];
};


}
#endif
